/****************************************************
* TABLE A8: Staff Compensation (Senate) Full Result 
****************************************************/
clear
use masterdata_senate1.dta
sort core_person_id
merge core_person_id using firstcong.dta
keep if _merge == 3
drop _merge
gen exp = 2*(congress - firstcong +1) 
la var firstcong "congress staffer appeared first time in the data"

gen memfemale = 0
replace memfemale = 1 if minwomen ==1
replace memfemale = 1 if majwomen ==1

gen femalestaff = 0
replace femalestaff = 1 if gender =="F"

gen int1 = dem*femalestaff
gen int2 = dem*femalestaff*memfemale

macro define member_char1 "dem memfemale majority chair subchr seniority maj_leader min_leader power up_for_reelection freshman"
macro define member_char2 "majority chair subchr seniority maj_leader min_leader power up_for_reelection freshman"
macro define staff_char1  "exp totworkdays rank nondc notfulltime"
macro define staff_char2  "exp totworkdays rank nondc notfulltime jdphd grad_degree"

eststo clear
eststo: quietly reg  salary femalestaff           $member_char1 $staff_char1 i.congress, vce(cluster member_office_id)
eststo: quietly reg  salary femalestaff int1      $member_char1 $staff_char1 i.congress, vce(cluster member_office_id)
eststo: quietly reg  salary femalestaff int1 int2 $member_char1 $staff_char1 i.congress, vce(cluster member_office_id)
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char1 i.congress, a(member_office_id) vce(cluster member_office_id)
eststo: quietly areg salary femalestaff int1 int2 $member_char2 $staff_char2 i.congress, a(member_office_id) vce(cluster member_office_id)
esttab, star(* 0.05 ** 0.01 *** 0.001) drop(*congress*) se ar2

